package com.debao.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.debao.system.mapper.InterestMapper;
import com.debao.system.domain.Interest;
import com.debao.system.service.IInterestService;

/**
 * 关注Service业务层处理
 * 
 * @author DeBao
 * @date 2024-07-25
 */
@Service
public class InterestServiceImpl implements IInterestService 
{
    @Autowired
    private InterestMapper interestMapper;

    /**
     * 查询关注
     * 
     * @param id 关注主键
     * @return 关注
     */
    @Override
    public Interest selectInterestById(Long id)
    {
        return interestMapper.selectInterestById(id);
    }

    /**
     * 根据用户ID和其他ID查询关注
     * @param userId
     * @param otherId
     * @return
     */
    @Override
    public Boolean selectInterestByUserId(Long userId, Long otherId) {
        return interestMapper.selectInterestByUserId(userId, otherId);
    }

    /**
     * 查询关注列表
     * 
     * @param interest 关注
     * @return 关注
     */
    @Override
    public List<Interest> selectInterestList(Interest interest)
    {
        return interestMapper.selectInterestList(interest);
    }

    /**
     * 新增关注
     * 
     * @param interest 关注
     * @return 结果
     */
    @Override
    public int insertInterest(Interest interest)
    {
        return interestMapper.insertInterest(interest);
    }

    /**
     * 修改关注
     * 
     * @param interest 关注
     * @return 结果
     */
    @Override
    public int updateInterest(Interest interest)
    {
        return interestMapper.updateInterest(interest);
    }

    /**
     * 批量删除关注
     * 
     * @param ids 需要删除的关注主键
     * @return 结果
     */
    @Override
    public int deleteInterestByIds(Long[] ids)
    {
        return interestMapper.deleteInterestByIds(ids);
    }

    /**
     * 删除关注信息
     * 
     * @param id 关注主键
     * @return 结果
     */
    @Override
    public int deleteInterestById(Long id)
    {
        return interestMapper.deleteInterestById(id);
    }

    /**
     * 取消关注
     * @param otherId
     * @param userId
     * @return
     */
    @Override
    public int deleteInterest(Long otherId, Long userId) {
        return interestMapper.deleteInterest(otherId, userId);
    }
}
